//package suanzi.core.db.service.impl;
//
//import com.alibaba.dubbo.config.annotation.Service;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import suanzi.core.db.entity.SysDatabase;
//import suanzi.core.db.service.ISysDataBaseService;
//
//import java.util.HashMap;
//import java.util.Map;
//
//
//@Service
//public class IDataBaseServiceImpl  {
//
//    Logger logger = LoggerFactory.getLogger(IDataBaseServiceImpl.class);
//    // mysql
//    private final String MYSQL = "MySQL";
//    private final String DriverName_MYSQL = "com.mysql.jdbc.Driver";// mysql驱动
//    private final String URL_MYSQL = "jdbc:mysql://";// mysql连接  如：jdbc:mysql://127.0.0.1:3306/tempdb
//
//    @Autowired
//    private ISysDataBaseService sysDataBaseService;
//
//
//    public Map<String, Object> getDataSource(String companyId) {
//        Map<String, Object> map = new HashMap<String, Object>();
//        map.put("driverClassName", DriverName_MYSQL);
//        try {
//            //先通过缓存查询
//            SysDatabase dateBase = sysDataBaseService.getDateSourceCache(companyId);
//            if (null != dateBase && null != dateBase.getIp()) {
//                String url = URL_MYSQL + dateBase.getIp() + ":" + dateBase.getPort() + "/" + dateBase.getDatebasename() + "?useUnicode=true&characterEncoding=UTF-8";
//                map.put("userName", dateBase.getUsername());
//                map.put("password", dateBase.getPassword());
//                map.put("url", url);
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//
//        return map;
//    }
//}
